<template>
    <div class='home-wrapper'>
      <div class='carousel-wrapper window-wrapper'>
        <div class='container'>
          <img :src="require('../assets/head_bg.jpg')"/>
        </div>
      </div>
      <BasicInfo />
      <Publications />
      <Activities />
      <Research />
      <div class='team-wrapper window-wrapper'>
        <div class='photos-container container'>
          <el-divider
            content-position='center'
          >{{ $store.state.language === 'zh-CN' ? '团队成员' : 'Team member'}}</el-divider>
          <div class='team-instance' v-for='item in StudentList' :key='item.name'>
            {{item.name}}
          </div>
        </div>
      </div>
      <div class='team-wrapper window-wrapper'>
        <div class='photos-container container'>
          <div class='img-instance' v-for='item in 6' :key='item'>
            <img :src='require(`../assets/research-group-${item}.jpg`)' />
          </div>
        </div>
      </div>
      <div class="window-wrapper">
        <Alumnus/>
      </div>
    </div>
</template>

<script lang='ts'>
import { Component, Vue } from 'vue-property-decorator';
import BasicInfo from '../components/BasicInfo.vue';
import Research from '../components/Research.vue';
import Publications from '../components/Publications.vue';
import Activities from '../components/Activities.vue';
import Alumnus from './Alum.vue';
import { iLabMember, iAlumnus } from '../typings/students';
import $api from '../api';
import mockLabMember from '../mock/labMember';

@Component({
  components: {
    BasicInfo,
    Research,
    Publications,
    Activities,
    Alumnus
  }
})
export default class Home extends Vue {

  private StudentList: iLabMember[] = [];

  private mounted() {
    this.getStudentList();
  };

  private getStudentList() {
    const succ = (res: any) => {
      this.StudentList = (res as any) || [];
    }
    if (this.$store.state.offModel) {
      succ(mockLabMember);
    } else {
      $api.students.findAllLabMembersClient().then(succ);
    }
  }

}
</script>

<style lang='scss'>
.carousel-wrapper {
  margin: 10px auto;
  padding: 0 30px;
  .container {
    width: 1200px;
    margin: auto;
    img{
      width: 100%;
    }
  }
  .el-carousel__item {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    color: white;
    text-align: left;
    .text-container {
      margin-top: 170px;
      text-align: left;
      margin-left: 10%;
      padding: 20px;
      background: rgba(255, 255, 255, 0.2);
      border-radius: 5px;
      display: inline-block;
    }
  }
  .el-carousel__item h3 {
    font-size: 18px;
    opacity: 0.75;
    margin: 0;
  }

  // .el-carousel__item:nth-child(3) {
  //   background-image: url('../assets/home-scroll-0.jpg');
  // }
  // .el-carousel__item:nth-child(4) {
  //   background-image: url('../assets/home-scroll-1.jpg');
  // }
  // .el-carousel__item:nth-child(5) {
  //   background-image: url('../assets/home-scroll-2.jpg');
  // }
  // .el-carousel__item:nth-child(6) {
  //   background-image: url('../assets/home-scroll-3.jpg');
  // }
  // .el-carousel__item:nth-child(7) {
  //   background-image: url('../assets/home-scroll-4.jpg');
  // }
}

.team-wrapper {
  padding: 15px 30px;
  .photos-container {
    width: 1200px;
    margin: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    .img-instance {
      width: 32%;
      margin-bottom: 15px;
      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
      box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.1);
    }
    .el-divider__text {
      background: #ececec;
      font-size: 20px;
      font-weight: bold;
      color: #113f6c;
    }
  }
}

// @media screen and (max-width: 640px) {
//   .carousel-wrapper {
//     margin: 15px;
//   }
// }
</style>